package com.ibeetl.cms.service;

import java.util.List;

import com.ibeetl.cms.entity.IndustrialTalents;
import com.ibeetl.cms.web.query.PreparatoryTalentQuery;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.ibeetl.cms.dao.PreparatoryTalentDao;
import com.ibeetl.cms.entity.PreparatoryTalent;
import com.ibeetl.admin.core.service.BaseService;

/**
 * PreparatoryTalent Service
 */

@Service
@Transactional
public class PreparatoryTalentService extends BaseService<PreparatoryTalent>{

    @Autowired
    private PreparatoryTalentDao preparatoryTalentDao;

    public PageQuery<PreparatoryTalent>queryByCondition(PageQuery query){
        PageQuery ret =  preparatoryTalentDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelPreparatoryTalent(List<Long> ids){
        try {
            preparatoryTalentDao.batchDelPreparatoryTalentByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除PreparatoryTalent失败", e);
        }
    }

    public PageQuery<PreparatoryTalent> queryEmployees(PageQuery page) {
        page.setPageSize(Integer.MAX_VALUE);

        PageQuery ret =  preparatoryTalentDao.queryEmployees(page);
        queryListAfter(ret.getList());
        return ret;
    }
    public List<PreparatoryTalent> queryCompany(PreparatoryTalentQuery condtion) {
        List<PreparatoryTalent> ret =  preparatoryTalentDao.queryCompany(condtion);
        queryListAfter(ret);
        return ret;
    }

    //查企业
    public PageQuery<PreparatoryTalent>findenterprise(PageQuery query){
        PageQuery ret =  preparatoryTalentDao.findenterprise(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public PageQuery<PreparatoryTalent> queryDoneTask(PageQuery page) {
        PageQuery ret =  preparatoryTalentDao.queryDoneTask(page);
        queryListAfter(ret.getList());
        return ret;

    }

    public int queryEmployeesCount(PreparatoryTalentQuery query) {
        return preparatoryTalentDao.queryEmployeesCount(query);

    }
}